package com.sixbing.demo.presenter;


import com.sixbing.demo.base.BasePresenter;
import com.company.module.net.bean.BaseBean;
import com.sixbing.demo.model.AppModel;
import com.sixbing.demo.bean.AppVersionNetBean;
import com.sixbing.demo.contract.AppHomeView;
import com.sixbing.demo.subscriber.MySubscriber;

/**
 * desc :
 * user : sixbing
 * time : 2019-03-27 15:07.
 * version : 1.0
 */

public class AppPresenter extends BasePresenter<AppHomeView.checkUpdateView> {
    private AppModel appModel;

    public AppPresenter() {
        appModel = new AppModel();
    }

    public void checkUpdate() {
        addCompositeDisposable(appModel.checkUpdate().subscribeWith(new MySubscriber<AppVersionNetBean>() {

            @Override
            public void onSuccess(BaseBean<AppVersionNetBean> tResponse) {
                mView.checkUpdateSuccess(tResponse);
            }

            @Override
            public void onFailed(BaseBean<AppVersionNetBean> tResponse) {
                mView.checkUpdateFault(tResponse);
            }
        }));
    }
}
